<?php
declare (strict_types=1);

namespace app\api\controller\v3;

use app\common\model\Datum;
use app\common\model\DatumCate;
use app\common\model\Record;

class Log extends BaseController
{
    /**
     * 记录已学的题
     *
     * @return \think\Response
     */

    public function index()
    {
        $id = input('id/d');
        $arr = Datum::where('id', $id)->field('id,unit_id,datum_cate_id,title,English,American,video,desc,example,translate,else')->find()->toArray();
        $v['datum_id'] = $arr['id'];
        $v['unit_id'] = $arr['unit_id'];
        $v['api_member_id'] = $this->user_id;
        $v['backend_member_id'] = $this->user_id;
        $v['datum_cate_id'] = $arr['datum_cate_id'];
        unset($arr['id']);
//        dd($arr);
        //合并
        $datas = array_merge($arr, $v);
        //dd($datas);
        $model = new Record();
        $data = $model->save($datas);
        return sucessMsg(200, '获取成功', ['data' => $data]);
    }
}
